<?php echo $header; ?>
<div id="content">
   <div class="breadcrumb">
    <?php echo $this->breadCrumbs(); ?>
  </div>
  <?php if (isset($error_warning)) { ?>
  <div class="warning"><?php echo $error_warning; ?></div>
  <?php } ?>
  <?php if ($success) { ?>
  <div class="success"><?php echo $success; ?></div>
  <?php } ?>
  <div class="box">
    <div class="heading">
      <h1><img src="view/image/mail.png" alt="" /><?php echo $_['heading_title'];?></h1>
      <div class="buttons">
      <a onclick="location = '<?php echo UA('sale/mail/insert'); ?>'" class="button"><span><?php echo $_['button_insert']; ?></span></a>
      <a onclick="$('#form').submit();" class="button"><span><?php echo $_['button_delete']; ?></span></a>
      
      </div>
    </div>
    <div class="content">
      <form action="<?php echo UA('sale/mail/delete'); ?>" method="post" enctype="multipart/form-data" id="form">
        <table class="list">
          <thead>
            <tr height="30">
              <td width="1" style="text-align: center;"><input type="checkbox" onclick="$('input[name*=\'selected\']').attr('checked', this.checked);" /></td>
              <td width="50">ID</td>
			  <td><?php echo $_['text_subject']; ?></td>
			  <td><a <?php echo sort_url('date_added');?>><?php echo $_['text_date_added'];?></a></td>
			  <td><a <?php echo sort_url('date_modified');?>><?php echo $_['text_date_modified'];?></a></td>
			  <td width="100"><?php echo $_['text_action']; ?></td>
            </tr>
          </thead>
          <tbody>
            <tr class="filter">
            	<td></td>
            	<td></td>
            	<td><input type="text" name="filter_subject" value="<?php echo $filter_subject;?>" size="15"></td>
            	<td></td>
            	<td></td>
            	<td align="right"><a onclick="filter();" class="button"><span><?php echo $_['button_filter'];?></span></a></td>
            </tr>
            <?php if ($mails) { ?>
            <?php foreach ($mails as $mail) { ?>
            <tr  height="30" onmouseover="this.className='on';" onmouseout="this.className='';">
              <td style="text-align: center;">
              <input type="checkbox" name="selected[]" value="<?php echo $mail['mail_id']; ?>" /></td>
			  <td><?php echo $mail['mail_id']; ?></td>
			  <td><?php echo $mail['subject']; ?></td>
			  <td><?php echo $mail['date_added']; ?></td>
			  <td><?php echo $mail['date_modified']; ?></td>
			  <td class="right">				
				[<a href="<?php echo UA('sale/mail/update'); ?>&mail_id=<?php echo $mail['mail_id']?>"><?php echo $_['text_edit']; ?></a>]
			  </td>
            </tr>
            <?php } ?>
            <?php } else { ?>
            <tr>
              <td class="center" colspan="15"><?php echo $_['text_no_results']; ?></td>
            </tr>
            <?php } ?>
          </tbody>
        </table>
      </form>
	  <div class="pagination"><?php echo $pagination; ?></div>
    </div>
  </div>
</div>
<script type="text/javascript"><!--
function filter() {
	url = '<?php echo UA('sale/mail', 'filter_reset=1'); ?>';

	v = $('input[name=\'filter_subject\']').attr('value');
	if (v != '*') {
		url += '&filter_subject=' + encodeURIComponent(v);
	}
	location = url;
}
//--></script>
<?php echo $footer; ?>